package com.evil.common.application.dto.permission.control;

import com.evil.common.application.dto.SourceDTO;
import com.evil.common.application.enums.form.ControlPermissionSourceTypeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Collection;

/**
 * @author liyang
 * @date 2022-08-08 00:00
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class ControlPermissionSourceDTO extends SourceDTO {

    private Collection<Long> controlIds;

    public ControlPermissionSourceDTO() {
        this.controlIds = new ArrayList<>();
    }

    public ControlPermissionSourceDTO(@NotNull(message = "源类型不能为空") Integer sourceType, @NotNull(message = "源id不能为空") Long sourceId) {
        super(sourceType, sourceId);
    }

    public ControlPermissionSourceDTO(@NotNull(message = "sourceType not null") ControlPermissionSourceTypeEnum controlPermissionSourceTypeEnum, @NotNull(message = "源id不能为空") Long sourceId) {
        super(controlPermissionSourceTypeEnum.getId(), sourceId);
    }

    public ControlPermissionSourceDTO(@NotNull(message = "源类型不能为空") Integer sourceType, @NotNull(message = "源id不能为空") Long sourceId, Collection<Long> controlIds) {
        super(sourceType, sourceId);
        this.controlIds = controlIds;
    }

    public ControlPermissionSourceDTO(@NotNull(message = "sourceType not null") ControlPermissionSourceTypeEnum controlPermissionSourceTypeEnum, @NotNull(message = "源id不能为空") Long sourceId, Collection<Long> controlIds) {
        super(controlPermissionSourceTypeEnum.getId(), sourceId);
        this.controlIds = controlIds;
    }
}
